home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / amos / AMOSList_0197.lzh / AMOSLIST / 000110_amos-request@svcs1.digex.net_Wed Jan 22 05:58:13 1997.msg < prev    next >
Internet Message Format  |  1997-02-02  |  3KB

  1. Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
  2.           by mail2.access.digex.net (8.8.4/8.8.4) with ESMTP
  3.       id FAA06689 for <mcox@access.digex.net>; Wed, 22 Jan 1997 05:58:11 -0500 (EST)
  4. Received: (from daemon@localhost)
  5.           by svcs1.digex.net (8.8.4/8.8.4)
  6.       id CAA28926 for amos-out; Wed, 22 Jan 1997 02:35:03 -0500 (EST)
  7. Received: from mail1.access.digex.net (mail1.access.digex.net [205.197.247.2])
  8.           by svcs1.digex.net (8.8.4/8.8.4) with ESMTP
  9.       id CAA28923 for <amos-list@svcs1.digex.net>; Wed, 22 Jan 1997 02:35:03 -0500 (EST)
  10. Received: from cheetah.spots.ab.ca (root@cheetah.spots.ab.ca [204.191.210.12])
  11.           by mail1.access.digex.net (8.8.4/8.8.4) with SMTP
  12.       id CAA15572 for <amos-list@access.digex.net>; Wed, 22 Jan 1997 02:35:00 -0500 (EST)
  13. Received: from dcousins (pm222.spots.ab.ca [204.191.210.72]) by cheetah.spots.ab.ca (8.6.12/8.6.12) with ESMTP id AAA04526; Wed, 22 Jan 1997 00:34:43 -0700
  14. Message-Id: <199701220734.AAA04526@cheetah.spots.ab.ca>
  15. From: "dcousins" <dcousins@spots.ab.ca>
  16. To: "Hakan Venderlof" <grok@karkis.canit.se>
  17. Cc: "AMOS List" <amos-list@access.digex.net>
  18. Subject: Re: goto
  19. Date: Sat, 8 Jan 2000 19:36:10 -0700
  20. X-MSMail-Priority: Normal
  21. X-Priority: 3
  22. X-Mailer: Microsoft Internet Mail 4.70.1155
  23. MIME-Version: 1.0
  24. Content-Type: text/plain; charset=ISO-8859-1
  25. Content-Transfer-Encoding: 7bit
  26. Status: RO
  27. X-Status: 
  28.  
  29. > From: Hakan Venderlof <grok@karkis.canit.se>
  30. > To: amos-list@access.digex.net
  31. > Subject: goto
  32. > Date: Monday, January 21, 2097 8:11 AM
  33. > Do
  34. > Goto Rnd(4)
  35. > 0
  36. > <bla>
  37. > 1
  38. > <bla>
  39. > 2
  40. > <bla>
  41. > 3
  42. > <bla>
  43. > 4
  44. > <bla>
  45. > Loop
  46. > How can I get the program to go to each label
  47. > only once?  (randomly)
  48. > I do know some complicated ways to achive this but there must be some
  49. easy
  50. > solution...?
  51.  
  52. I suppose you want an indefinate number of 'goto's.  This is really simple,
  53. and you shouldn't use goto's at all.  If you only want them to be execute
  54. once, then use an If..ElseIf..ElseIf..EndIf like the case function from
  55. 'C'.
  56.  
  57. If you want a number of functions to be executed in a random order, use a
  58. for loop, not a do.  Set up an array, then randomize it, then go through it
  59. using gosub's.  Here it is (I don't know if it works, just typing this on
  60. my PC).
  61.  
  62. Dim A(xx) : Rem Where xx is the number of procedures
  63. For I=0 to xx
  64.     A(I)=I
  65. Next I
  66. For I=0 to xx
  67.     Swap A(Rnd(xx),Rnd(xx))
  68. Next I
  69. For I=0 to xx
  70.     Gosub A(I)
  71. Next I
  72. End
  73.  
  74. 1    Rem Place Your code here.
  75.     Return
  76. 2    Rem Place Some more code here.
  77.     Return
  78. 3
  79. ...
  80. xx    Last Bit of code
  81.     Return
  82.  
  83. > I think it should be possible to use arrays but I don't know how to set
  84. it up.
  85.  
  86.     If this doesn't work (AMOS may not have true computed jumps, I can't
  87. remember right now), I figure out a different way.
  88.  
  89.     TTFN
  90.  
  91.     David